<template>
  <div class="message-detail">
    <div class="message-header">
        <div :class="'message-type'+messageDetail.type">{{messageDetail.type == 2 ? '库存预警' : messageDetail.type == 3 ? "订单消息" : "通知" }}</div>
        <div class="message-time">{{messageDetail.addTime}}</div>
    </div>
    {{messageDetail.content}}
  </div>

</template>

<script>
import row from '@/components/row'
import api from '@/api/api.js' 
export default { 
  components: {
    row
  },
  data () {
    return {
      userInfo:'',
      messageDetail: this.$store.state.messageDetail
    }
  },
  mounted () {
    this.userInfo = JSON.parse(localStorage.hj_userInfo);
    this.getDetail(this.messageDetail.id)  
  },
  filters: {
     
  },
  methods: {
    getDetail(id){
      api.messageMng.setRead({
        messageId:id
      },res=>{  }) 
    }
  }
}
</script>
<style lang="less" scoped>
    .message-detail{
        padding: 12px 20px;
        line-height: 20px;
        color: #666;
    }
  .message-header{
    display: flex;
    justify-content: space-between;
    height: 42px;
    align-items: center; 
  }
  .message-time{
    color: #999;
  }
  .message-type1{
    color: chocolate;
  }
  .message-type2{
    color: darkblue;
  }
  .message-type3{
    color: #FABE00;
  }
</style>